behavior when keys already exist on add (instead of dying with an error...)
* Add a hook 'UploadForm:initial' before the upload form is generated, and two
member variable for text injection into the form, which can be filled by the hooks.
+* (bug 6295) Add a "revision patching" functionality, where an edit can be undone
+ (with a functionality similar to diff rev1 rev2 | patch -R rev3 -o rev3).
+ This is triggered by including &undo=revid in an edit URL. A link to a URL
+ that will undo a given edit is shown on NEW NON-CURRENT revision headers on diff pages.
== Languages updated ==
} else {
$newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid );
$newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mNewid );
+ $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undo=' . $this->mNewid );
$this->mPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $timestamp ) );
$this->mNewtitle = "<strong><a href='$newLink'>{$this->mPagetitle}</a></strong>"
- . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)";
+ . " (<a href='$newEdit'>" . htmlspecialchars( wfMsg( 'editold' ) ) . "</a>)"
+ . " (<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)";
}
// Load the old revision object
# Get variables from query string :P
$section = $wgRequest->getVal( 'section' );
$preload = $wgRequest->getVal( 'preload' );
+ $undo = $wgRequest->getVal( 'undo' );
wfProfileIn( __METHOD__ );
// information.
$text = $this->mArticle->getContent();
-
- if( $section != '' ) {
+
+ if ( $undo > 0 ) {
+ #Undoing a specific edit overrides section editing; section-editing
+ # doesn't work with undoing.
+ $undorev = Revision::newFromId($undo);
+ $oldrev = $undorev->getPrevious();
+
+ #Sanity check, make sure it's the right page.
+ # Otherwise, $text will be left as-is.
+ if ($undorev->getPage() == $this->mArticle->getID()) {
+ $undorev_text = $undorev->getText();
+ $oldrev_text = $oldrev->getText();
+ $currev_text = $text;
+
+ $result = wfMerge($undorev_text, $oldrev_text, $currev_text, &$text);
+
+ if (!$result) {
+ #Undoing failed. Bailing out with regular revision text.
+ $text = $currev_text;
+ }
+ }
+ }
+ else if( $section != '' ) {
if( $section == 'new' ) {
$text = $this->getPreloadedText( $preload );
} else {
'selectnewerversionfordiff' => 'Select a newer version for comparison',
'selectolderversionfordiff' => 'Select an older version for comparison',
'compareselectedversions' => 'Compare selected versions',
+'editundo' => 'undo',
# Search results
#